package com.kw.drug.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kw.drug.entity.Owinfo;
import com.kw.drug.entity.Returngoods;
import com.kw.drug.mapper.ReturngoodsMapper;
import com.kw.drug.service.ReturngoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class returngoodsServiceImpl implements ReturngoodsService {
    @Autowired
    ReturngoodsMapper returngoodsMapper;

    @Override

    public IPage<Returngoods> problemQueryPage(String param, Integer pageSize, Integer pageNum) {
        QueryWrapper<Returngoods> queryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotEmpty(param)) {
            queryWrapper.like("dname", param);
        }
        Page<Returngoods> page = new Page<>(pageNum, pageSize);
        Page<Returngoods> page1 = returngoodsMapper.selectPage(page, queryWrapper);
        return page1;
    }

    @Override
    public Returngoods selectreturngoodById(Integer id) {
        Returngoods returngoods = returngoodsMapper.selectById(id);
        return returngoods;
    }

    /**
     * 通过删除记录
     */
    @Override
    public Integer returngoodsDelById(Integer id) {
        return returngoodsMapper.deleteById(id);
    }

    /**
     * 修改
     */
    @Override
    public Integer returngoodsEdit(Returngoods returngoods) {
        int i = returngoodsMapper.updateById(returngoods);
        return i;
    }

    @Override
    public Integer addReturnGoods(Returngoods returngoods) {
        int insert = returngoodsMapper.insert(returngoods);
        return insert;
    }
}

